package com.yanghui.lingyue.data

import com.icedata.sika.database.Column
import com.icedata.sika.database.Table
import com.yanghui.lingyue.utils.timeUtils.TimeUtils
import kotlinx.serialization.Serializable

@Serializable
@Table("Users", "", "id")
data class User(

    @Column("userName")
    var name: String,

    @Column("id")
    var id: Long,

    @Column("isSpecial")
    var isSpecial: Boolean,

    @Column("isAdministrator")
    var isAdministrator: Boolean,

    @Column("isForbidden")
    var isForbidden: Boolean,

    @Column("favor")
    var favor: Int,

    @Column("gender")
    var gender: Short,

    @Column("balance")
    var balance: Double,

    @Column("birthday")
    var birthday: String
) {
    constructor(command: Command) : this(
        name = command.event.sender.name,
        id = command.event.sender.id,
        isSpecial = false,
        isAdministrator = false,
        isForbidden = false,
        favor = (10..100).shuffled().last(),
        gender = 0,
        balance = 1000.0,
        birthday = TimeUtils.getTodayString()
    )
    constructor(): this("",0,false,false,false,0,0,0.0, TimeUtils.getTodayString())
}

